import string, secrets


def gen_int(length: int = 5) -> str:
    """
    生成指定长度的纯数字字符串
    @param length: 字符长度
    return
    """
    characters = string.digits
    ret = "".join(secrets.choice(characters) for i in range(length))
    return ret


def genkey(length: int=32) -> str:
    """
    生成指定长度的随机字符串
    :param length: 生成的字符串的长度
    :return: 字符串
    """
    characters = string.ascii_letters        # 26个小写字母和26个大写字母
    characters = characters + string.digits  # 10个数字
    characters = characters + '!@$%^&*./=-' # 特殊符号
    return "".join(secrets.choice(characters) for i in range(length))

if __name__ == '__main__':
#     print(gen_int(5))
    print(genkey(64))